import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    redirect: '/home',
    component: () => import('@/views/Layout/index.vue'),
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('@/views/Home/index.vue'),
        meta: {
          root: true,
          title: '首页'
        }
      },
      {
        path: '/podcast',
        name: 'podcast',
        component: () => import('@/views/Podcast/index.vue'),
        meta: {
          root: true,
          title: '播客'
        }
      },
      {
        path: '/community',
        name: 'community',
        component: () => import('@/views/Community/index.vue'),
        meta: {
          root: true,
          title: '社区'
        }
      },
      {
        path: '/user',
        name: 'user',
        component: () => import('@/views/User/index.vue'),
        meta: {
          root: true,
          title: '我的'
        }
      }
    ]
  },
  {
    path: '/playlist',
    name: 'playlist',
    component: () => import('@/components/MusicList.vue'),
    meta: {
      root: false,
      title: '歌单列表'
    }
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('@/components/Search/index.vue'),
    meta: {
      root: false,
      title: '搜索'
    }
  },
  {
    path: '/album',
    name: 'album',
    component: () => import('@/components/AlbumList.vue'),
    meta: {
      root: false,
      title: '新歌专辑'
    }
  },
  {
    path: '/square',
    name: 'square',
    component: () => import('@/components/PlayList/index.vue'),
    meta: {
      root: false,
      title: '歌单广场'
    }
  },
  {
    path: '/mvlist',
    name: 'mvlist',
    component: () => import('@/components/MVList/index.vue'),
    meta: {
      root: false,
      title: 'MV列表'
    }
  },
  {
    path: '/mvlist/detail',
    name: 'mvdetail',
    component: () => import('@/components/MVList/MvDetail.vue'),
    meta: {
      root: false,
      title: 'MV详情'
    }
  },
  {
    path: '/singer/detail',
    nam: 'singerdeteail',
    component: () => import('@/components/Singer/index.vue'),
    meta: {
      root: false,
      title: '歌手详情'
    }
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
